{% extends "default/base.html" %}
{% block content %}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div id="ibox-content" class="ibox-title">
                    <h5> 用户日志详细信息列表 </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">未启用 1</a>
                            </li>
                            <li><a href="#">未启用 2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="panel-options">
                        <ul class="nav nav-tabs">
                            <li><a href="/message/news/" class="text-center"><i class="fa fa-laptop"></i> 当前任务 </a></li>
                            <li class="active"><a href="/message/oldnew/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
                            <li style="float: right">
                                <form id="search_form" method="get" action="" class="pull-right mail-search">
                                    <div class="input-group">
                                        <input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
                                        <input type="text" style="display: none">
                                        <div class="input-group-btn">
                                            <button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="log_search()">
                                                Search
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </li>
                        </ul>
                    </div>
                    <br/>
                    <div class="tab-content">
                        <table class="table table-striped table-bordered table-hover ">
                            <thead>
                                <tr>
                                    <th class="text-center"> 申请人 </th>
                                    <th class="text-center"> 项目名称 </th>
                                    <th class="text-center"> 模块名称 </th>
                                    <th class="text-center"> 测试人员 </th>
                                    <th class="text-center"> 运维人员 </th>

                                </tr>
                            </thead>
                            <tbody>
                            {% for i in user_message %}
                                <tr class="gradeX">
                                    <td class="text-center" id="username"> {{ i.applyer }} </td>
                                    <td class="text-center" id="ip"> {{ i.project_name }} </td>
                                    <td class="text-center">{{ i.module_name }} </td>
                                    <td class="text-center" id="start_time"> {{ i.qa }} </td>
                                    <td class="text-center" id="end_time"> {{ i.op }} </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                        <div class="row">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script>


    function log_search(){
        $.ajax({
            type: "GET",
            url: "/jlog/search/?env=offline",
            data: $("#search_form").serialize(),
            success: function (data) {
                $(".tab-content").html(data);
            }
        });
    }

    $("#search_input").keydown(function(e){
        if(e.keyCode==13){
            log_search()
            }
    })

</script>

{% endblock content %}